library(ggplot2)
library(dplyr)##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(tidyverse)## ── Attaching packages ─────────────────────────────────────── tidyverse 1.3.0 ──
## ✓ tibble 3.1.0 ✓ purrr 0.3.4
## ✓ tidyr 1.1.3 ✓ stringr 1.4.0
## ✓ readr 1.4.0 ✓ forcats 0.5.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(arsenal)
library(data.table)##
## Attaching package: 'data.table'
## The following object is masked from 'package:purrr':
##
## transpose
## The following objects are masked from 'package:dplyr':
##
## between, first, last
library(expss)##
## Attaching package: 'expss'
## The following objects are masked from 'package:data.table':
##
## copy, like
## The following objects are masked from 'package:stringr':
##
## fixed, regex
## The following objects are masked from 'package:purrr':
##
## keep, modify, modify_if, transpose, when
## The following objects are masked from 'package:tidyr':
##
## contains, nest
## The following objects are masked from 'package:dplyr':
##
## between, compute, contains, first, last, na_if, recode, vars
## The following object is masked from 'package:ggplot2':
##
## vars
sleephygiene <- read_csv("/Users/Ivanics/Desktop/SPH/3rd term/Health Communication Programs I/Stats/Sleep Hygiene Survey_March 11, 2021_13.57.csv")## Warning: Duplicated column names deduplicated: 'Q37' => 'Q37_1' [64]
##
## ── Column specification ────────────────────────────────────────────────────────
## cols(
## .default = col_character()
## )
## ℹ Use `spec()` for the full column specifications.
sleephygiene$StartDate <- lubridate::ymd_hms(sleephygiene$StartDate)## Warning: 2 failed to parse.
#Filter to include only responses beyond this time
sleephygiene <- sleephygiene %>% filter(StartDate >= "2021-03-09 18:00:00")
#Select out the variables we need
sleephygiene <- sleephygiene %>% select(Progress, `Duration (in seconds)`, Finished, LocationLatitude, LocationLongitude, DistributionChannel, UserLanguage, Q1, Q2, Q3, Q2_5_TEXT, Q4, Q5, Q6, Q37, Q38, Q39, Q7, Q8, Q8_3_TEXT, Q10, Q11, Q9, Q13, Q13, Q14_10, Q14_11, Q15, Q16_4, Q16_5, Q49, Q42, Q42_10_TEXT, Q19, Q17_NPS_GROUP, Q17, Q36, Q36_6_TEXT, Q18, Q20, Q9, Q13, Q14_10, Q14_11, Q15, Q16_4, Q16_5, Q49, Q42, Q42_10_TEXT, Q19, Q12_1, Q17_NPS_GROUP, Q17, Q36, Q36_6_TEXT, Q18, Q20, Q44_1, Q44_2, Q44_3, Q44_4, Q44_5, Q44_6, Q44_7, Q44_8, Q44_9, Q59_1, Q59_2, Q59_2, Q59_3, Q59_4, Q37_1, Q33, Q50_1, Q50_2, Q50_3, Q50_4, Q50_5, Q50_6, Q50_7, Q53_1, Q53_2, Q53_3, Q53_4, Q53_5, Q48, Q48_5_TEXT, Q52, `Q5 - Topics`, `Q5 - Parent Topics`)
sleephygiene <- rowid_to_column(sleephygiene, "ID")#Variable 14
sleephygiene$Q14_10_new_hours <- sub(":.*", "", sleephygiene$Q14_10)
sleephygiene$Q14_10_new_hours <- ifelse(nchar(sleephygiene$Q14_10_new_hours)==3, (str_extract(sleephygiene$Q14_10_new_hours, "^\\d{1}")), sleephygiene$Q14_10_new_hours)
sleephygiene$Q14_10_new_hours <- ifelse(nchar(sleephygiene$Q14_10_new_hours)==4, (str_extract(sleephygiene$Q14_10_new_hours, "^\\d{2}")), sleephygiene$Q14_10_new_hours)
sleephygiene$Q14_10_new_minutes <- str_extract(sleephygiene$Q14_10, "(?<=:)[0-9]*")
sleephygiene$Q14_10_new_minutes <- ifelse(is.na(sleephygiene$Q14_10_new_minutes) & !is.na(sleephygiene$Q14_10_new_hours), "00", sleephygiene$Q14_10_new_minutes)
sleephygiene$Q14_10_new_hours <- as.numeric(sleephygiene$Q14_10_new_hours)
sleephygiene$Q14_10_new_minutes <- ifelse(grepl("[0-9]+", sleephygiene$Q14_11), sleephygiene$Q14_11, sleephygiene$Q14_10_new_minutes)
sleephygiene$Q14_10_new_hours <- ifelse(grepl("[pP][mM]", sleephygiene$Q14_11), sleephygiene$Q14_10_new_hours+12, sleephygiene$Q14_10_new_hours)
sleephygiene$Q14_10_new_hours <- as.character(sleephygiene$Q14_10_new_hours)
#Variable 16
#Put in a semicolon
sleephygiene$Q16_4_new_hours <- sub(":.*", "", sleephygiene$Q16_4)
#If the length of the string is 3 extract the first digit
sleephygiene$Q16_4_new_hours <- ifelse(nchar(sleephygiene$Q16_4_new_hours)==3, (str_extract(sleephygiene$Q16_4_new_hours, "^\\d{1}")), sleephygiene$Q16_4_new_hours)
#if the length of the string is 4 extract the second digit
sleephygiene$Q16_4_new_hours <- ifelse(nchar(sleephygiene$Q16_4_new_hours)==4, (str_extract(sleephygiene$Q16_4_new_hours, "^\\d{2}")), sleephygiene$Q16_4_new_hours)
#if theres a number in the q16_5 variable put it in minutes
sleephygiene$Q16_4_new_minutes <- str_extract(sleephygiene$Q16_5, "(?<=:)[0-9]*")
#if the q16_4 minute variable has missing values replace them with 00
sleephygiene$Q16_4_new_minutes <- ifelse(is.na(sleephygiene$Q16_4_new_minutes) & !is.na(sleephygiene$Q16_4_new_hours), "00", sleephygiene$Q16_4_new_minutes)
#If there is a number in q16_5 put that in minutes
sleephygiene$Q16_4_new_minutes <- ifelse(grepl("[0-9]+", sleephygiene$Q16_5), sleephygiene$Q16_5, sleephygiene$Q16_4_new_minutes)
#if there is a ncar length of 5 in q16_4 (suggesting a format like 16:00) take the 4 and 5 digits and put that in minutes
sleephygiene$Q16_4_new_minutes <- ifelse(nchar(sleephygiene$Q16_4)==5, substr(sleephygiene$Q16_4, 4, 5), sleephygiene$Q16_4_new_minutes)
#make the hour variable a numeric
sleephygiene$Q16_4_new_hours <- as.numeric(sleephygiene$Q16_4_new_hours)
#if there is a pm add 12 hours in q16_5 to the hours
sleephygiene$Q16_4_new_hours <- ifelse(grepl("[pP]", sleephygiene$Q16_5), sleephygiene$Q16_4_new_hours+12, sleephygiene$Q16_4_new_hours)
#if there is a 12 in q16_4 and am has been noted also add 12 hours
sleephygiene$Q16_4_new_hours <- ifelse((grepl("[12]", sleephygiene$Q16_4) & grepl("[aA][mM]", sleephygiene$Q16_5)), sleephygiene$Q16_4_new_hours+12, sleephygiene$Q16_4_new_hours)
#Make the hours a character now in preparation to convert to posixct
sleephygiene$Q16_4_new_hours <- as.character(sleephygiene$Q16_4_new_hours)
sleephygiene <- sleephygiene %>% mutate(Q16_4_new_hours = case_when(
Q16_4_new_hours == "24" ~ "00",
Q16_4_new_hours == "13" & grepl("[aA]", Q16_5) ~ "01",
Q16_4_new_hours == "7" ~ "07",
TRUE ~ Q16_4_new_hours
))
#Create a sleeptime and wakeup variable
sleephygiene <- sleephygiene %>%
mutate(Q14_wakeuptime =
case_when(!is.na(Q14_10_new_hours) ~ paste0(Q14_10_new_hours,":",Q14_10_new_minutes),
TRUE ~ NA_character_)) %>%
mutate(Q16_sleeptime =
case_when(!is.na(Q16_4_new_hours) ~ paste0(Q16_4_new_hours,":",Q16_4_new_minutes),
TRUE ~ NA_character_))
sleephygiene$Q14_wakeuptime <- as.POSIXct(sleephygiene$Q14_wakeuptime, format="%H:%M")
#sleephygiene$Q16_sleeptime <- as.POSIXct(sleephygiene$Q16_sleeptime, format="%H:%M")
#sleephygiene %>% select(Q14_10_new_hours, Q14_10_new_minutes, Q14_11, Q14_wakeuptime, Q14_10) %>% View()#General factor recoding
sleephygiene <- sleephygiene %>% mutate(
Q1_consent = factor(Q1)) %>%
mutate(Q2_program = factor(Q2)) %>%
mutate(Q3_role = factor(Q3)) %>%
mutate(Q4_gender = factor(Q4)) %>%
mutate(Q5_age = as.numeric(Q5)) %>%
mutate(Q6_numberinhousehold = as.numeric(Q6)) %>%
mutate(Q37_employed = factor(Q37)) %>%
mutate(Q38_wfh = factor(Q38)) %>%
mutate(Q39_dayornight = factor(Q39)) %>%
mutate(Q7_children = factor(Q7)) %>%
mutate(Q8_diagnosis = factor(Q8)) %>%
mutate(Q10_workdayhoursofsleep = as.numeric(Q10)) %>%
mutate(Q11_weekendhoursofsleep = as.numeric(Q11)) %>%
mutate(Q9_howoftensleepy = factor(Q9)) %>%
mutate(Q13_consistentwakeup = factor(Q13)) %>%
mutate(Q15_consistentbedtimeonweekdays = factor(Q15)) %>%
mutate(Q49_sleepqualitychangecovid = factor(Q49)) %>%
mutate(Q18_howoftenpracticemindfullness = factor(Q18)) %>%
mutate(Q44_1_thingsidointhelasthourbeforesleepaffectthequalityofmysleep = factor(Q44_1)) %>%
mutate(Q44_2_gettingagoodnightssleepisimportantome = factor(Q44_2)) %>%
mutate(Q44_3_mostofmyfriendshaveahealthysleeproutine = factor(Q44_3)) %>%
mutate(Q44_4_lackofsleepaffectsmyacademicperformance = factor(Q44_4)) %>%
mutate(Q44_5_havingaregularsleeproutineimprovesmentalclariy = factor(Q44_5)) %>%
mutate(Q44_6_ifeelpositiveaboutthequalityofmysleep = factor(Q44_6)) %>%
mutate(Q44_7_ithinkcuttingoutscreenuseonehourbeforesleepleadstobettersleep = factor(Q44_7)) %>%
mutate(Q44_8_ithinkingworkingoutregularlyleadstobettersleep = factor(Q44_8)) %>%
mutate(Q44_9_ithinkmeditatingbeforesleephelpsquality = factor(Q44_9)) %>%
mutate(Q59_1_icanmaintainhealthysleephabits = factor(Q59_1)) %>%
mutate(Q59_2_icancutoutscreenuseonehourbeforesleep = factor(Q59_2)) %>%
mutate(Q59_3_icanworkoutregularly = factor(Q59_3)) %>%
mutate(Q59_4_icanmediatebeforebed = factor(Q59_4)) %>%
mutate(Q37_whatdoyouconsideragoodnightssleep = factor(Q37_1))## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion
#Q19
sleephygiene$Q19_howmanyhourssdidyouuseascreen <- str_extract(sleephygiene$Q19, '\\d+')
#Q12
sleephygiene$Q12_1_howmanynightsusescreen <- as.numeric(sleephygiene$Q12_1)
#Q17
sleephygiene$Q17_stressedaboutschool <- as.numeric(sleephygiene$Q17)
#Q33
#Come back to this one because some are given as a range
sleephygiene$Q33_whatisthrecommendednumbersofhoursofsleep <- str_extract(sleephygiene$Q33, '\\d+')
sleephygiene$Q33_whatisthrecommendednumbersofhoursofsleep <- as.numeric(sleephygiene$Q33_whatisthrecommendednumbersofhoursofsleep)
#Q50
sleephygiene <- sleephygiene %>%
mutate(Q50_1_energyfordailyacitivites = as.numeric(Q50_1)) %>%
mutate(Q50_2_attractivness = as.numeric(Q50_2)) %>%
mutate(Q50_3_productivity = as.numeric(Q50_3)) %>%
mutate(Q50_4_accomplishmentofotherdailygoals = as.numeric(Q50_4)) %>%
mutate(Q50_5_mentalandemotionalwellbeing = as.numeric(Q50_5)) %>%
mutate(Q50_6_fosteringmaintaingrelationships = as.numeric(Q50_6)) %>%
mutate(Q50_7_caringforchildren = as.numeric(Q50_7))
#Q53
sleephygiene <- sleephygiene %>%
mutate(Q53_1_getoutsidefor10mininthemorning = as.numeric(Q53_1)) %>%
mutate(Q53_2_exerciseduringtheday = as.numeric(Q53_2)) %>%
mutate(Q53_3_doingabreathingexercisebeforesleep = as.numeric(Q53_3)) %>%
mutate(Q53_4_notusescreens = as.numeric(Q53_4)) %>%
mutate(Q53_5_listeningtoacalmingaudiobookorpodcast = as.numeric(Q53_5))#Q42
resp.split_42 <- strsplit(sleephygiene$Q42, ",")
lev <- unique(unlist(resp.split_42))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_42, function(x) table(factor(x, levels=lev))))))
sleephygiene <- sleephygiene %>%
mutate(bedtimeroutine = case_when(
Washing.my.face == 1 ~ "Washing my face",
Brushing.teeth == 1 ~ "Brushing teeth",
Showering == 1 ~ "Showering",
Reading == 1 ~ "Reading",
Journaling == 1 ~ "Journaling",
Meditating == 1 ~ "Meditating",
Watching.TV == 1 ~ "Watching TV",
Phone.Usage == 1 ~ "Phone usage",
Listening.to.Music == 1 ~ "Listening to music",
Other == 1 ~ "Other"))
#Q36
resp.split_36 <- strsplit(sleephygiene$Q36, ",")
lev <- unique(unlist(resp.split_36))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_36, function(x) table(factor(x, levels=lev))))))
sleephygiene <- sleephygiene %>%
mutate(cantsleepfeeling = case_when(
Guilty == 1 ~ "Guilty",
Angry == 1 ~ "Angry",
Frustrated == 1 ~ "Frustrated",
Sad == 1 ~ "Sad",
Stressed == 1 ~ "Stressed",
None.of.the.above == 1 ~ "None of the above",
Other.1 == 1 ~ "Other"))
#Q20
resp.split_20 <- strsplit(sleephygiene$Q20, ",")
lev <- unique(unlist(resp.split_20))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_20, function(x) table(factor(x, levels=lev))))))
sleephygiene <- sleephygiene %>%
mutate(behaviors = case_when(
Cigarette.Smoking == 1 ~ "Cigarette smoking",
Alcohol.Consumption == 1 ~ "Alcohol Consumption",
Exercise == 1 ~ "Exercise",
Social.Media.Use == 1 ~ "Social Media Use",
Daytime.Napping == 1 ~ "Daytime napping",
Drinking.Caffeinated.beverages == 1 ~ "Drinking Caffeinated beverages",
Using.Sleep.Aids..ex..melatonin == 1 ~ "Using Sleep Aids ex. melatonin"))
#48
resp.split_48 <- strsplit(sleephygiene$Q48, ",")
lev <- unique(unlist(resp.split_48))
sleephygiene<- with(sleephygiene, data.frame(sleephygiene, t(sapply(resp.split_48, function(x) table(factor(x, levels=lev))))))
sleephygiene <- sleephygiene %>%
mutate(information = case_when(
Health.care.professional == 1 ~ "Health care professional",
Social.media == 1 ~ "Social media",
Other.online.source == 1 ~ "Other online source",
News.sources == 1 ~ "News sources",
Friends == 1 ~ "Friends",
University.wellbeing.resources..Office.of.Wellness.and.Health.Promotion == 1 ~ "University wellbeing resources"))Plots for wakeup and sleep times
library(plotly)##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
wakeup <- ggplot(data=sleephygiene, aes(y=Q14_wakeuptime,x=ID)) +
geom_point(size=4, color="darkblue") +
theme_test() +
theme(text = element_text(size=32), plot.title = element_text(hjust = 0.5)) +
labs(title="Wake up times of participants", x="Unique participant", y="Wake up time")
#+
#xlim(as.POSIXct(c("2021-03-10 05:00:00", "2021-03-10 12:00:00")))
ggplotly(wakeup)#Plot for sleeptime
sleeptime <- ggplot(data=sleephygiene, aes(y=Q16_sleeptime,x=ID)) +
geom_point(size=4, color="darkred") +
theme_test() +
theme(text = element_text(size=32), plot.title = element_text(hjust = 0.5)) +
labs(title="Sleep times of participants", x="Unique participant", y="Sleep time")
ggplotly(sleeptime)#Tab 1
sleephygiene$Q9_howoftensleepy <- factor(sleephygiene$Q9_howoftensleepy, levels = c("Rarely", "Sometimes", "Very often", "Always"))
sleephygiene$Q13_consistentwakeup <- factor(sleephygiene$Q13_consistentwakeup, levels = c("Rarely", "Sometimes", "Very often", "Always"))
sleephygiene$Q19_howmanyhourssdidyouuseascreen <- factor(sleephygiene$Q19_howmanyhourssdidyouuseascreen, levels = c("0", "1" , "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17"))
sleephygiene$Q18_howoftenpracticemindfullness <- factor(sleephygiene$Q18_howoftenpracticemindfullness, levels = c("Rarely", "Sometimes", "Very often", "Always"))
sleephygiene$Q44_1_thingsidointhelasthourbeforesleepaffectthequalityofmysleep <- factor(sleephygiene$Q44_1_thingsidointhelasthourbeforesleepaffectthequalityofmysleep, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_2_gettingagoodnightssleepisimportantome <- factor(sleephygiene$Q44_2_gettingagoodnightssleepisimportantome, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_3_mostofmyfriendshaveahealthysleeproutine <- factor(sleephygiene$Q44_3_mostofmyfriendshaveahealthysleeproutine, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_4_lackofsleepaffectsmyacademicperformance <- factor(sleephygiene$Q44_4_lackofsleepaffectsmyacademicperformance, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_5_havingaregularsleeproutineimprovesmentalclariy <- factor(sleephygiene$Q44_5_havingaregularsleeproutineimprovesmentalclariy, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_6_ifeelpositiveaboutthequalityofmysleep <- factor(sleephygiene$Q44_6_ifeelpositiveaboutthequalityofmysleep, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_7_ithinkcuttingoutscreenuseonehourbeforesleepleadstobettersleep <- factor(sleephygiene$Q44_7_ithinkcuttingoutscreenuseonehourbeforesleepleadstobettersleep, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_8_ithinkingworkingoutregularlyleadstobettersleep <- factor(sleephygiene$Q44_8_ithinkingworkingoutregularlyleadstobettersleep, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q44_9_ithinkmeditatingbeforesleephelpsquality <- factor(sleephygiene$Q44_9_ithinkmeditatingbeforesleephelpsquality, levels = c("Strongly disagree", "Somewhat disagree", "Neither agree nor disagree", "Somewhat agree", "Strongly agree"))
sleephygiene$Q59_1_icanmaintainhealthysleephabits <- factor(sleephygiene$Q59_1_icanmaintainhealthysleephabits, levels = c("Not at all confident", "Slightly confident", "Somewhat confident", "Pretty confident", "Extremely confident"))
sleephygiene$Q59_2_icancutoutscreenuseonehourbeforesleep <- factor(sleephygiene$Q59_2_icancutoutscreenuseonehourbeforesleep, levels = c("Not at all confident", "Slightly confident", "Somewhat confident", "Pretty confident", "Extremely confident"))
sleephygiene$Q59_3_icanworkoutregularly <- factor(sleephygiene$Q59_3_icanworkoutregularly, levels = c("Not at all confident", "Slightly confident", "Somewhat confident", "Pretty confident", "Extremely confident"))
sleephygiene$Q59_4_icanmediatebeforebed <- factor(sleephygiene$Q59_4_icanmediatebeforebed, levels = c("Not at all confident", "Slightly confident", "Somewhat confident", "Pretty confident", "Extremely confident"))
library(expss)
sleephygiene = apply_labels(sleephygiene,
Q3_role = "What is your role at Bloomberg",
Q4_gender = "What gender do you identify as?",
Q5_age = "How old are you?",
Q6_numberinhousehold = "How many people live in your household, including yourself?",
Q37_employed = "Are you currently employed outside of your education program?",
Q8_diagnosis = "Have you ever been diagnosed with any of the following sleep disorders?",
Q10_workdayhoursofsleep = "During the past 5 workdays, how many hours of sleep did you get per night on average?",
Q11_weekendhoursofsleep = "During the past weekend, how many hours of sleep did you get per night on average? ",
Q13_consistentwakeup = "Do you have a consistent time you wake up on weekdays?",
Q15_consistentbedtimeonweekdays = "Do you have a consistent time you wake up on weekdays?",
Q9_howoftensleepy = "How often do you feel sleepy during the day?",
Q2_program = "What is your current program at Bloomberg?",
Q38_wfh = "Do you work from home?",
Q39_dayornight = "Do you work day or night shifts?",
Q49_sleepqualitychangecovid = "Has your sleep quality changed due to the COVID-19 pandemic? ",
bedtimeroutine = "My bedtime routine includes:",
Q19_howmanyhourssdidyouuseascreen = "How many hours per day do you typically use a screen? (i.e. cell phone, tablet, computer, television)",
Q12_1_howmanynightsusescreen = "In the past week, how many nights did you use screens (i.e. cell phone, tablet, computer, television) within 1 hour before bed?",
Q17_stressedaboutschool = "How stressed do you currently feel about school?",
cantsleepfeeling = "When you can't sleep do you feel",
Q18_howoftenpracticemindfullness = "How often do you practice mindfulness techniques? (i.e. breathing exercises, meditation, etc.,)",
behaviors = "Which of the following behaviors do you participate in? ",
Q44_1_thingsidointhelasthourbeforesleepaffectthequalityofmysleep = "The things I do in the last hour before bed affect the quality of my sleep.",
Q44_2_gettingagoodnightssleepisimportantome = "Getting a good night's sleep is important to me.",
Q44_3_mostofmyfriendshaveahealthysleeproutine = "Most of my friends have a healthy sleep routine.",
Q44_4_lackofsleepaffectsmyacademicperformance = "Lack of sleep affects my academic performance.",
Q44_5_havingaregularsleeproutineimprovesmentalclariy = "Having a regular sleep routine improves mental clarity/sharpness.",
Q44_6_ifeelpositiveaboutthequalityofmysleep = "I feel positive about the quality of my sleep.",
Q44_7_ithinkcuttingoutscreenuseonehourbeforesleepleadstobettersleep = "I think cutting out screen use 1 hour before bed leads to better sleep.",
Q44_8_ithinkingworkingoutregularlyleadstobettersleep = "I think working out regularly leads to better sleep.",
Q44_9_ithinkmeditatingbeforesleephelpsquality = "I think meditating before bed helps sleep quality.",
Q59_1_icanmaintainhealthysleephabits = "I can maintain healthy sleep habits.",
Q59_2_icancutoutscreenuseonehourbeforesleep = "I can cut out screen use 1 hour before bed.",
Q59_3_icanworkoutregularly = "I can work out regularly.",
Q59_4_icanmediatebeforebed = "I can meditate before bed.",
Q37_whatdoyouconsideragoodnightssleep = "What do you consider a good night's sleep?",
Q50_1_energyfordailyacitivites = "Energy for daily activities",
Q50_2_attractivness = "Attractiveness (to self & others)",
Q50_3_productivity = "Productivity at work/school",
Q50_4_accomplishmentofotherdailygoals = "Accomplishment of other daily goals (e.g. exercise, cooking, paying bills, etc)",
Q50_5_mentalandemotionalwellbeing = "Mental and emotional wellbeing",
Q50_6_fosteringmaintaingrelationships = "Fostering/maintaining relationships",
Q50_7_caringforchildren = "Caring for children",
Q53_1_getoutsidefor10mininthemorning = "Get outside for 10 minutes in the morning." ,
Q53_2_exerciseduringtheday = "Exercise during the day.",
Q53_3_doingabreathingexercisebeforesleep = "Do a breathing exercise before you sleep.",
Q53_4_notusescreens = "Not use screens (i.e. cell phone, tablet, computer, television) for 1 hour before bed",
Q53_5_listeningtoacalmingaudiobookorpodcast = "Listen to a calming audiobook or podcast before bed",
information = "Where have you seen or received information about sleep quality or sleep hygiene?"
)tab1 <- tableby(~ Q3_role +
Q4_gender +
Q5_age +
Q6_numberinhousehold +
Q37_employed +
Q8_diagnosis +
Q10_workdayhoursofsleep +
Q11_weekendhoursofsleep +
Q9_howoftensleepy,
data=sleephygiene, test=TRUE, total=TRUE,
numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab1, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)| Overall (N=51) | |
|---|---|
| What is your role at Bloomberg | |
| Â Â Â N-Miss | 1 |
| Â Â Â Faculty/Staff Member | 1 (2.0%) |
| Â Â Â Full-time student | 48 (96.0%) |
| Â Â Â Part-time student | 1 (2.0%) |
| What gender do you identify as? | |
| Â Â Â N-Miss | 1 |
| Â Â Â Female | 42 (84.0%) |
| Â Â Â Male | 6 (12.0%) |
| Â Â Â Non-binary / third gender | 2 (4.0%) |
| How old are you? | |
| Â Â Â Median (Q1, Q3) | 27.00 (24.00, 30.00) |
| How many people live in your household, including yourself? | |
| Â Â Â Median (Q1, Q3) | 2.00 (1.00, 3.00) |
| Are you currently employed outside of your education program? | |
| Â Â Â N-Miss | 1 |
| Â Â Â No | 35 (70.0%) |
| Â Â Â Yes | 15 (30.0%) |
| Have you ever been diagnosed with any of the following sleep disorders? | |
| Â Â Â N-Miss | 1 |
| Â Â Â Insomnia | 1 (2.0%) |
| Â Â Â No | 48 (96.0%) |
| Â Â Â Sleep Apnea | 1 (2.0%) |
| During the past 5 workdays, how many hours of sleep did you get per night on average? | |
| Â Â Â Median (Q1, Q3) | 7.00 (6.00, 8.00) |
| During the past weekend, how many hours of sleep did you get per night on average? | |
| Â Â Â Median (Q1, Q3) | 8.00 (7.00, 9.00) |
| How often do you feel sleepy during the day? | |
| Â Â Â N-Miss | 13 |
| Â Â Â Rarely | 9 (23.7%) |
| Â Â Â Sometimes | 28 (73.7%) |
| Â Â Â Very often | 0 (0.0%) |
| Â Â Â Always | 1 (2.6%) |
#If student
student <- sleephygiene %>% filter(Q3_role != "Faculty/Staff Member")
tab1 <- tableby(~ Q2_program,
data=student, test=TRUE, total=TRUE,
numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab1, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)| Overall (N=49) | |
|---|---|
| What is your current program at Bloomberg? | |
| Â Â Â Doctoral Student | 19 (38.8%) |
| Â Â Â Masters Student | 28 (57.1%) |
| Â Â Â Post doctoral student | 2 (4.1%) |
#If employed
employed <- sleephygiene %>% filter(Q37_employed == "Yes")
tab1 <- tableby(~ Q38_wfh,
data=employed, test=TRUE, total=TRUE,
numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab1, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)| Overall (N=15) | |
|---|---|
| Do you work from home? | |
| Â Â Â No | 3 (20.0%) |
| Â Â Â Yes | 12 (80.0%) |
#If wfh
notworkfromhome <- sleephygiene %>% filter(Q37_employed == "Yes" & Q38_wfh == "No")
tab1 <- tableby(~ Q39_dayornight,
data=notworkfromhome, test=TRUE, total=TRUE,
numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab1, title='Table 1. Baseline information', pfootnote=TRUE, digits = 2)| Overall (N=3) | |
|---|---|
| Do you work day or night shifts? | |
| Â Â Â Day shift | 2 (66.7%) |
| Â Â Â Night shift | 1 (33.3%) |
tab1 <- tableby(~ Q13_consistentwakeup +
Q15_consistentbedtimeonweekdays +
Q49_sleepqualitychangecovid +
bedtimeroutine +
Q19_howmanyhourssdidyouuseascreen +
Q12_1_howmanynightsusescreen +
Q17_stressedaboutschool +
cantsleepfeeling +
Q18_howoftenpracticemindfullness +
behaviors +
Q44_1_thingsidointhelasthourbeforesleepaffectthequalityofmysleep +
Q44_2_gettingagoodnightssleepisimportantome +
Q44_3_mostofmyfriendshaveahealthysleeproutine +
Q44_4_lackofsleepaffectsmyacademicperformance +
Q44_5_havingaregularsleeproutineimprovesmentalclariy +
Q44_6_ifeelpositiveaboutthequalityofmysleep +
Q44_7_ithinkcuttingoutscreenuseonehourbeforesleepleadstobettersleep +
Q44_8_ithinkingworkingoutregularlyleadstobettersleep +
Q44_9_ithinkmeditatingbeforesleephelpsquality +
Q59_1_icanmaintainhealthysleephabits +
Q59_2_icancutoutscreenuseonehourbeforesleep +
Q59_3_icanworkoutregularly +
Q59_4_icanmediatebeforebed +
Q37_whatdoyouconsideragoodnightssleep +
Q50_1_energyfordailyacitivites +
Q50_2_attractivness +
Q50_3_productivity +
Q50_4_accomplishmentofotherdailygoals +
Q50_5_mentalandemotionalwellbeing +
Q50_6_fosteringmaintaingrelationships +
Q50_7_caringforchildren +
Q53_1_getoutsidefor10mininthemorning +
Q53_2_exerciseduringtheday +
Q53_3_doingabreathingexercisebeforesleep +
Q53_4_notusescreens +
Q53_5_listeningtoacalmingaudiobookorpodcast +
information,
data=sleephygiene, test=TRUE, total=TRUE,
numeric.stats=c("medianq1q3"), numeric.test="kwt", cat.test="chisq")
summary(tab1, title='Table 2. Sleep questions', pfootnote=TRUE, digits = 2)| Overall (N=51) | |
|---|---|
| Do you have a consistent time you wake up on weekdays? | |
| Â Â Â N-Miss | 45 |
| Â Â Â Rarely | 0 (0.0%) |
| Â Â Â Sometimes | 6 (100.0%) |
| Â Â Â Very often | 0 (0.0%) |
| Â Â Â Always | 0 (0.0%) |
| Do you have a consistent time you wake up on weekdays? | |
| Â Â Â N-Miss | 1 |
| Â Â Â No | 13 (26.0%) |
| Â Â Â Sometimes | 14 (28.0%) |
| Â Â Â Yes | 23 (46.0%) |
| Has your sleep quality changed due to the COVID-19 pandemic? | |
| Â Â Â N-Miss | 1 |
| Â Â Â No | 25 (50.0%) |
| Â Â Â Yes, I feel my sleep quality has improved | 8 (16.0%) |
| Â Â Â Yes, I feel my sleep quality has worsened | 17 (34.0%) |
| My bedtime routine includes: | |
| Â Â Â N-Miss | 1 |
| Â Â Â Brushing teeth | 14 (28.0%) |
| Â Â Â Phone usage | 2 (4.0%) |
| Â Â Â Reading | 1 (2.0%) |
| Â Â Â Washing my face | 32 (64.0%) |
| Â Â Â Watching TV | 1 (2.0%) |
| How many hours per day do you typically use a screen? (i.e. cell phone, tablet, computer, television) | |
| Â Â Â N-Miss | 2 |
| Â Â Â 0 | 0 (0.0%) |
| Â Â Â 1 | 0 (0.0%) |
| Â Â Â 2 | 0 (0.0%) |
| Â Â Â 3 | 0 (0.0%) |
| Â Â Â 4 | 2 (4.1%) |
| Â Â Â 5 | 1 (2.0%) |
| Â Â Â 6 | 2 (4.1%) |
| Â Â Â 7 | 1 (2.0%) |
| Â Â Â 8 | 4 (8.2%) |
| Â Â Â 9 | 3 (6.1%) |
| Â Â Â 10 | 18 (36.7%) |
| Â Â Â 11 | 1 (2.0%) |
| Â Â Â 12 | 10 (20.4%) |
| Â Â Â 13 | 1 (2.0%) |
| Â Â Â 14 | 3 (6.1%) |
| Â Â Â 15 | 1 (2.0%) |
| Â Â Â 16 | 1 (2.0%) |
| Â Â Â 17 | 1 (2.0%) |
| In the past week, how many nights did you use screens (i.e. cell phone, tablet, computer, television) within 1 hour before bed? | |
| Â Â Â Median (Q1, Q3) | 7.00 (6.00, 7.00) |
| How stressed do you currently feel about school? | |
| Â Â Â Median (Q1, Q3) | 7.00 (6.00, 8.00) |
| When you can’t sleep do you feel | |
| Â Â Â N-Miss | 1 |
| Â Â Â Angry | 1 (2.0%) |
| Â Â Â Frustrated | 31 (62.0%) |
| Â Â Â Guilty | 7 (14.0%) |
| Â Â Â None of the above | 2 (4.0%) |
| Â Â Â Other | 4 (8.0%) |
| Â Â Â Sad | 1 (2.0%) |
| Â Â Â Stressed | 4 (8.0%) |
| How often do you practice mindfulness techniques? (i.e. breathing exercises, meditation, etc.,) | |
| Â Â Â N-Miss | 13 |
| Â Â Â Rarely | 15 (39.5%) |
| Â Â Â Sometimes | 21 (55.3%) |
| Â Â Â Very often | 0 (0.0%) |
| Â Â Â Always | 2 (5.3%) |
| Which of the following behaviors do you participate in? | |
| Â Â Â N-Miss | 2 |
| Â Â Â Alcohol Consumption | 28 (57.1%) |
| Â Â Â Cigarette smoking | 1 (2.0%) |
| Â Â Â Daytime napping | 1 (2.0%) |
| Â Â Â Exercise | 14 (28.6%) |
| Â Â Â Social Media Use | 5 (10.2%) |
| The things I do in the last hour before bed affect the quality of my sleep. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Strongly disagree | 3 (6.0%) |
| Â Â Â Somewhat disagree | 5 (10.0%) |
| Â Â Â Neither agree nor disagree | 5 (10.0%) |
| Â Â Â Somewhat agree | 22 (44.0%) |
| Â Â Â Strongly agree | 15 (30.0%) |
| Getting a good night’s sleep is important to me. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Strongly disagree | 1 (2.0%) |
| Â Â Â Somewhat disagree | 0 (0.0%) |
| Â Â Â Neither agree nor disagree | 2 (4.0%) |
| Â Â Â Somewhat agree | 8 (16.0%) |
| Â Â Â Strongly agree | 39 (78.0%) |
| Most of my friends have a healthy sleep routine. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Strongly disagree | 4 (8.0%) |
| Â Â Â Somewhat disagree | 9 (18.0%) |
| Â Â Â Neither agree nor disagree | 24 (48.0%) |
| Â Â Â Somewhat agree | 10 (20.0%) |
| Â Â Â Strongly agree | 3 (6.0%) |
| Lack of sleep affects my academic performance. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Strongly disagree | 2 (4.0%) |
| Â Â Â Somewhat disagree | 3 (6.0%) |
| Â Â Â Neither agree nor disagree | 3 (6.0%) |
| Â Â Â Somewhat agree | 24 (48.0%) |
| Â Â Â Strongly agree | 18 (36.0%) |
| Having a regular sleep routine improves mental clarity/sharpness. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Strongly disagree | 0 (0.0%) |
| Â Â Â Somewhat disagree | 0 (0.0%) |
| Â Â Â Neither agree nor disagree | 2 (4.0%) |
| Â Â Â Somewhat agree | 16 (32.0%) |
| Â Â Â Strongly agree | 32 (64.0%) |
| I feel positive about the quality of my sleep. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Strongly disagree | 5 (10.0%) |
| Â Â Â Somewhat disagree | 11 (22.0%) |
| Â Â Â Neither agree nor disagree | 5 (10.0%) |
| Â Â Â Somewhat agree | 22 (44.0%) |
| Â Â Â Strongly agree | 7 (14.0%) |
| I think cutting out screen use 1 hour before bed leads to better sleep. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Strongly disagree | 3 (6.0%) |
| Â Â Â Somewhat disagree | 1 (2.0%) |
| Â Â Â Neither agree nor disagree | 11 (22.0%) |
| Â Â Â Somewhat agree | 22 (44.0%) |
| Â Â Â Strongly agree | 13 (26.0%) |
| I think working out regularly leads to better sleep. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Strongly disagree | 0 (0.0%) |
| Â Â Â Somewhat disagree | 0 (0.0%) |
| Â Â Â Neither agree nor disagree | 3 (6.0%) |
| Â Â Â Somewhat agree | 16 (32.0%) |
| Â Â Â Strongly agree | 31 (62.0%) |
| I think meditating before bed helps sleep quality. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Strongly disagree | 3 (6.0%) |
| Â Â Â Somewhat disagree | 4 (8.0%) |
| Â Â Â Neither agree nor disagree | 17 (34.0%) |
| Â Â Â Somewhat agree | 16 (32.0%) |
| Â Â Â Strongly agree | 10 (20.0%) |
| I can maintain healthy sleep habits. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Not at all confident | 3 (6.0%) |
| Â Â Â Slightly confident | 5 (10.0%) |
| Â Â Â Somewhat confident | 17 (34.0%) |
| Â Â Â Pretty confident | 19 (38.0%) |
| Â Â Â Extremely confident | 6 (12.0%) |
| I can cut out screen use 1 hour before bed. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Not at all confident | 10 (20.0%) |
| Â Â Â Slightly confident | 16 (32.0%) |
| Â Â Â Somewhat confident | 8 (16.0%) |
| Â Â Â Pretty confident | 11 (22.0%) |
| Â Â Â Extremely confident | 5 (10.0%) |
| I can work out regularly. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Not at all confident | 4 (8.0%) |
| Â Â Â Slightly confident | 7 (14.0%) |
| Â Â Â Somewhat confident | 16 (32.0%) |
| Â Â Â Pretty confident | 10 (20.0%) |
| Â Â Â Extremely confident | 13 (26.0%) |
| I can meditate before bed. | |
| Â Â Â N-Miss | 1 |
| Â Â Â Not at all confident | 10 (20.0%) |
| Â Â Â Slightly confident | 11 (22.0%) |
| Â Â Â Somewhat confident | 13 (26.0%) |
| Â Â Â Pretty confident | 10 (20.0%) |
| Â Â Â Extremely confident | 6 (12.0%) |
| What do you consider a good night’s sleep? | |
| Â Â Â N-Miss | 1 |
| Â Â Â 7 hours | 6 (12.0%) |
| Â Â Â 8 hours | 35 (70.0%) |
| Â Â Â 9 hours | 8 (16.0%) |
| Â Â Â Less than or equal to 6 hours | 1 (2.0%) |
| Energy for daily activities | |
| Â Â Â Median (Q1, Q3) | 5.00 (4.00, 5.00) |
| Attractiveness (to self & others) | |
| Â Â Â Median (Q1, Q3) | 3.00 (2.00, 4.00) |
| Productivity at work/school | |
| Â Â Â Median (Q1, Q3) | 5.00 (4.00, 5.00) |
| Accomplishment of other daily goals (e.g. exercise, cooking, paying bills, etc) | |
| Â Â Â Median (Q1, Q3) | 4.00 (4.00, 5.00) |
| Mental and emotional wellbeing | |
| Â Â Â Median (Q1, Q3) | 5.00 (4.00, 5.00) |
| Fostering/maintaining relationships | |
| Â Â Â Median (Q1, Q3) | 4.00 (3.00, 4.75) |
| Caring for children | |
| Â Â Â Median (Q1, Q3) | 1.00 (1.00, 2.00) |
| Get outside for 10 minutes in the morning. | |
| Â Â Â Median (Q1, Q3) | 4.00 (2.00, 5.00) |
| Exercise during the day. | |
| Â Â Â Median (Q1, Q3) | 4.00 (3.00, 5.00) |
| Do a breathing exercise before you sleep. | |
| Â Â Â Median (Q1, Q3) | 3.00 (2.00, 4.00) |
| Not use screens (i.e. cell phone, tablet, computer, television) for 1 hour before bed | |
| Â Â Â Median (Q1, Q3) | 3.00 (2.00, 3.75) |
| Listen to a calming audiobook or podcast before bed | |
| Â Â Â Median (Q1, Q3) | 3.00 (2.00, 4.00) |
| Where have you seen or received information about sleep quality or sleep hygiene? | |
| Â Â Â N-Miss | 2 |
| Â Â Â Friends | 2 (4.1%) |
| Â Â Â Health care professional | 18 (36.7%) |
| Â Â Â News sources | 2 (4.1%) |
| Â Â Â Other online source | 6 (12.2%) |
| Â Â Â Social media | 16 (32.7%) |
| Â Â Â University wellbeing resources | 5 (10.2%) |
attach(sleephygiene)Fig 1
ggplot(sleephygiene) +
geom_bar(aes(x=Q3_role), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=32)) +
labs(title = "Role") +
xlab("")Fig 2
ggplot(student) +
geom_bar(aes(x=Q2_program), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=32)) +
labs(title = "What is your current program at Bloomberg?") +
xlab("")Fig 3
ggplot(student) +
geom_bar(aes(x=Q4_gender), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=32)) +
labs(title = "What gender do you identify as?") +
xlab("")Fig 4
ggplot(student) +
geom_bar(aes(x=Q37_employed), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=32)) +
labs(title = "Are you currently employed outside of your education program?") +
xlab("")Fig 5
ggplot(employed) +
geom_bar(aes(x=Q38_wfh), fill="navyblue") +
coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=32)) +
labs(title = "Do you work from home?") +
xlab("")Fig 6
ggplot(notworkfromhome) +
geom_bar(aes(x=Q39_dayornight), fill="navyblue") +
coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=32)) +
labs(title = "Do you work day or night shifts?") +
xlab("")Fig 7
ggplot(sleephygiene) +
geom_bar(aes(x=Q7_children), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=15)) +
labs(title = "Are there children living in your household?") +
xlab("")Fig 8
ggplot(sleephygiene) +
geom_bar(aes(x=Q8_diagnosis), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=20), axis.text.x = element_text(size=32)) +
labs(title = "Have you ever been diagnosed with any of the following sleep disorders?") +
xlab("")Fig 9
ggplot(sleephygiene) +
geom_bar(aes(x=Q9_howoftensleepy), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=32)) +
labs(title = "How often do you feel sleepy during the day?") +
xlab("")Fig 10
ggplot(sleephygiene) +
geom_bar(aes(x=Q13_consistentwakeup), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=32)) +
labs(title = "Do you have a consistent time you wake up on weekdays?") +
xlab("")Fig 11
ggplot(sleephygiene) +
geom_bar(aes(x=Q15_consistentbedtimeonweekdays), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Do you have a consistent bedtime on weekdays?") +
xlab("")Fig 12
ggplot(sleephygiene) +
geom_bar(aes(x=Q49_sleepqualitychangecovid), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Has your sleep quality changed due to the COVID-19 pandemic?") +
xlab("")Fig 13
ggplot(sleephygiene) +
geom_bar(aes(x=bedtimeroutine), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "My bedtime routine includes") +
xlab("")Fig 14
ggplot(sleephygiene) +
geom_bar(aes(x=Q17_stressedaboutschool), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "How stressed do you currently feel about school?") +
xlab("")## Warning: Removed 1 rows containing non-finite values (stat_count).
Fig 15
ggplot(sleephygiene) +
geom_bar(aes(x=cantsleepfeeling), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "When you can't sleep do you feel") +
xlab("")Fig 16
ggplot(sleephygiene) +
geom_bar(aes(x=Q18_howoftenpracticemindfullness), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "How often do you practice mindfulness techniques? (i.e. breathing exercises, meditation, etc.,") +
xlab("")Fig 17
ggplot(sleephygiene) +
geom_bar(aes(x=behaviors), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Which of the following behaviors do you participate in? Check all that apply. ") +
xlab("")Fig 18
ggplot(sleephygiene) +
geom_bar(aes(x=Q44_1_thingsidointhelasthourbeforesleepaffectthequalityofmysleep), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "The things I do in the last hour before bed affect the quality of my sleep.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q44_2_gettingagoodnightssleepisimportantome), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Getting a good night's sleep is important to me.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q44_3_mostofmyfriendshaveahealthysleeproutine), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Most of my friends have a healthy sleep routine.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q44_4_lackofsleepaffectsmyacademicperformance), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Lack of sleep affects my academic performance.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q44_5_havingaregularsleeproutineimprovesmentalclariy), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Having a regular sleep routine improves mental clarity/sharpness.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q44_6_ifeelpositiveaboutthequalityofmysleep), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I feel positive about the quality of my sleep.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q44_7_ithinkcuttingoutscreenuseonehourbeforesleepleadstobettersleep), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I think cutting out screen use 1 hour before bed leads to better sleep.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q44_8_ithinkingworkingoutregularlyleadstobettersleep), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I think working out regularly leads to better sleep.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q44_9_ithinkmeditatingbeforesleephelpsquality), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I think meditating before bed helps sleep quality.") +
xlab("")Fig 19
ggplot(sleephygiene) +
geom_bar(aes(x=Q59_1_icanmaintainhealthysleephabits), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I can maintain healthy sleep habits.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q59_2_icancutoutscreenuseonehourbeforesleep), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I can cut out screen use 1 hour before bed.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q59_3_icanworkoutregularly), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I can work out regularly.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q59_4_icanmediatebeforebed), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I can meditate before bed.") +
xlab("")Fig 20
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_1_energyfordailyacitivites), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Energy for daily activities") +
xlab("")## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_2_attractivness), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Attractiveness (to self & others)") +
xlab("")## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_3_productivity), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Productivity at work/school") +
xlab("")## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_4_accomplishmentofotherdailygoals), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Accomplishment of other daily goals (e.g. exercise, cooking, paying bills, etc)") +
xlab("")## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_5_mentalandemotionalwellbeing), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Mental and emotional wellbeing") +
xlab("")## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_6_fosteringmaintaingrelationships), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Fostering/maintaining relationships") +
xlab("")## Warning: Removed 1 rows containing non-finite values (stat_count).
ggplot(sleephygiene) +
geom_bar(aes(x=Q50_7_caringforchildren), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "Caring for children") +
xlab("")## Warning: Removed 2 rows containing non-finite values (stat_count).
Fig 21
ggplot(sleephygiene) +
geom_bar(aes(x=Q59_1_icanmaintainhealthysleephabits), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I can maintain healthy sleep habits.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q59_2_icancutoutscreenuseonehourbeforesleep), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I can cut out screen use 1 hour before bed.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q59_3_icanworkoutregularly), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I can work out regularly.") +
xlab("")ggplot(sleephygiene) +
geom_bar(aes(x=Q59_4_icanmediatebeforebed), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=32), axis.text.x = element_text(size=18)) +
labs(title = "I can meditate before bed.") +
xlab("")Fig 22
ggplot(sleephygiene) +
geom_bar(aes(x=information), fill="navyblue") +
#coord_flip() +
theme_test() +
theme(text = element_text(size=20), axis.text.x = element_text(size=16)) +
labs(title = "Where have you seen or received information about sleep quality or sleep hygiene? Check all that apply. ") +
xlab("")